// Copyright (c) 2022 CHANGLEI. All rights reserved.

import 'package:aircraft_war/components/enemy_aircraft.dart';
import 'package:aircraft_war/foundation/sounds.dart';
import 'package:bloc/bloc.dart';

/// Created by changlei on 2022/5/19.
///
/// 分数
class GameScoreCubit extends Cubit<int> {
  /// 分数
  GameScoreCubit() : super(0);

  /// 命中
  void hit(EnemyType enemyType) {
    emit(state + enemyType.aliveValue * 1000);
    switch (enemyType) {
      case EnemyType.small:
        Sounds.smallEnemyDown();
        break;
      case EnemyType.middle:
        Sounds.largeEnemyDown();
        break;
      case EnemyType.large:
        Sounds.middleEnemyDown();
        break;
    }
  }

  /// 重置
  void reset() {
    emit(0);
  }
}
